// TOWN DIALOGUE SCRIPT
//    Town 126: Farport

begintalkscript;

variables;

short i,j,k,r1,choice;

// Orseena

begintalknode;
	tag = 40;
	state = -1;
	nextstate = 1;
	question = "Orseena";
	text1 = "A tired looking woman greets you with a cup of tea. She doesn't seem to mind that you broke into her home. _I'm Orseena. Welcome to my homey, rustic little cottage. I have rooms to rent for respectable young people._";
	text5 = "Orseena pours you some tea and smiles. _It's good to talk to travelers. It passes the time._";
	action = INTRO;

begintalknode;
	state = 1;
	nextstate = 2;
	question = "_What sort of business are you in?_";
	text1 = "She tries to smile warmly, but it just doesn't work out. _I run a little bed and breakfast here. There's a nice cozy room available next door. Only five coins for the night. It's what I do while my hubby is away._";

begintalknode;
	state = 2;
	nextstate = 3;
	question = "_Where is your husband?_";
	text1 = "Her eyes get a far away look and worry wrinkles appear on her forehead. _He's a soldier. He's off fighting._";

begintalknode;
	state = 3;
	nextstate = -1;
	question = "_Fighting who?_";
	text1 = "_He's off fighting the slimes._ She looks very sad.";
	text3 = "_He is helping clear out the few slimes that remain. It is sad that he is so far away, but I think he will return soon._";
	action = DEP_ON_SDF 307 3 0;

begintalknode;
	state = 3;
	nextstate = -1;
	question = "_How long will he be gone?_";
	text1 = "_His duty is almost a year more. He's not a young man, and it's terribly dangerous. But I hope, and pray. I'm sure he'll return. I'm sure of it!_ An uncomfortable silence follows.";
	text3 = "_I got a letter from him just the other day. He says he may be home in a few weeks. I hope it is true. Until then, I must make do._";
	action = DEP_ON_SDF 307 3 0;
	
begintalknode;
	state = 1;
	nextstate = -1;
	condition = coins_amount() >= 5;
	question = "_I'd like to rent that room you mentioned._ Pay five coins.";
	text1 = "She lets you into the promised cozy room next door, and bids you good night. The next morning, she greets you with hot water, tea and crumpets. You've spent worse nights.";
	action = END_TALK;	
	code =
		revive_party();
		change_coins(-5);
		sf(126,15,1);
		relocate_char(get_pc_id(0),21,23,FALSE);
		relocate_char(get_pc_id(1),22,23,FALSE);
		relocate_char(get_pc_id(2),22,24,FALSE);
		relocate_char(get_pc_id(3),21,24,FALSE);
	break;


begintalknode;
	state = 1;
	nextstate = -1;
	condition = 1;
	question = "_I have to go._";
	text1 = "_Have a lovely day._";
	action = END_TALK;

// Mrrhrr

begintalknode;
	tag = 60;
	state = -1;
	nextstate = 29;
	question = "Mrrhrr";
	text1 = "A muscled, efficiently built nephil stands at the anvil, carefully shaping an axe head. You cannot help but admire the skill and patience he is putting into working the metal. He turns to you. _I am Mrrhrr. Welcome to my shop._";
	text5 = "Mrrhrr waits patiently. He doesn't make a move to sell you anything. He's very confident in the quality of his goods.";
	action = INTRO;

begintalknode;
	state = 29;
	nextstate = 30;
	question = "_How is business?_";
	text1 = "_Mrrr. I do little now. The shortages are great. I cannot travel far. So I stay here, and make do with what I can get. Things are rare._";

begintalknode;
	state = 30;
	nextstate = -1;
	question = "_What's causing the shortages?_";
	text1 = "He shakes his head, and his tail twitches nervously. _Little shipping happens now, with all monsters everywhere. I cannot get fresh metal to forge weapons._";
	text2 = "_Thus, I spend my time only doing improvements on things. Repairing the rivets. Sharpening the plows._";

begintalknode;
	state = 30;
	nextstate = -1;
	question = "_Why don't you travel?_";
	text1 = "He shakes his head. _Today and for years, much hatred is in the Empire for my kind. Is better here, but if I go far, humans be very dark._";
	text2 = "_I prefer not to speak of it._";

begintalknode;
	state = 30;
	nextstate = 31;
	question = "_What sort of arms do you make?_";
	text1 = "He purrs. _Weapons that are not so good as what I could do with good metal. But good weapons, which will do the job. And armor._";
	text2 = "_I help you, warrior. Two bars of fine steel. A crystal with energy. I make them to fine breastplate._";
	
		
begintalknode;
	state = 31;
	nextstate = -1;
	condition = num_of_item(295) >= 1 && num_of_item(296) >= 2;
	question = "_Can you make a nice breastplate for me?_ (Give two pieces of fine steel and one focusing crystal.)";
	text1 = "_I could, but you don't have enough money._";
	text2 = "The smith takes your materials and invites you to leave and explore the town for a while.";
	text3 = "When you return, you collect a fine new breastplate.";
	action = REUSABLE;
	code =	
		cs();
		if (coins_amount() < 0)
			as(1);
			else {
				as(2); as(3);
				inc_flag(309,18,1);
				take_num_of_item(295,1);
				take_num_of_item(296,2);
				reward_give(34);
				}
	break;

begintalknode;
	state = 31;
	nextstate = 29;
	question = "_No, thank you._";
	text1 = "_What else, then?_";


begintalknode;
	state = 29;
	nextstate = -1;
	question = "_I don't meet many nephilim in Empire towns._";
	text1 = "_It is safer here, but more dangerous to north. Mrrr. I like seeing other nephil, like you, in the towns. It makes me feel things are still safe._";
	text3 = "_Here, it is safe, for now, for me to work and do. My kind must fear yours, this is the sad way of things._";
	code =
		if (species_in_party(2))
			remove_string(3);
			else remove_string(1);
	break;

begintalknode;
	state = 29;
	nextstate = -1;
	question = "_Can I do some trading?_";
	text1 = "You conclude your business.";
	code =
		begin_shop_mode("Mrrhrr","You are surprised that Mrrhrr has been able to make weapons of this quality, considering the poor materials available to him.",44,4,3);
	break;

begintalknode;
	state = 29;
	nextstate = -1;
	question = "_I don't need anything else._";
	text1 = "_Mrrr. Goodbye._";
	action = END_TALK;

// Nell

begintalknode;
	tag = 80;
	state = -1;
	nextstate = 57;
	question = "Nell";
	text1 = "There is an elderly woman in the robes of a mage sitting at the desk. She was writing when you came in, but she sets aside her pen and smiles. _I am Nell. Welcome, Avernite._";
	text5 = "Nell smiles. _Anything else? You are far from home, Avernite. I would be happy to assist you._";
	action = INTRO;

begintalknode;
	state = 57;
	nextstate = 58;
	question = "_How do you know I'm from Avernum?_";
	text1 = "_Your skin is the easiest clue. I am sort of an Avernite myself, having had to leave my home recently. Now I am a scribe._";

begintalknode;
	state = 58;
	nextstate = -1;
	condition = has_spec_item(40) > 0;
	question = "_Where are you from?_";
	text1 = "She starts to speak, but then she sees your Anama ring. She looks very uncomfortable. _I am sorry. I am busy. Good day._";
	action = END_TALK;

begintalknode;
	state = 58;
	nextstate = 60;
	condition = has_spec_item(40) <= 0;
	question = "_Where are you from?_";
	text1 = "_I understand something of being in exile from your home. I am a native of the Isle of Bigail. If you want to go there, you can get a boat at the north end of town. Unfortunately, I had to leave. I was harassed by the Anama._";

begintalknode;
	state = 60;
	nextstate = 61;
	question = "_What did the Anama do to you?_";
	text1 = "_The Anama control the Isle of Bigail, my long-time home. They make life difficult for any mages there. I can understand their prejudice about magic in this day and age, but you can't blame me for not wanting to be subjected to it._";


begintalknode;
	state = 61;
	nextstate = 62;
	question = "_So you left because you feared the Anama?_";
	text1 = "_No. I did fear them, but I would not let them drive me from my home. No, I left because my home was infested with roaches. I lived in Shayder, but the guards wouldn't help me._";
	text3 = "_No. I did fear them, but I would not let them drive me from my home. No, I left because my home was infested with roaches. Now that you have cleared them out, I hope to return soon._";
	action = DEP_ON_SDF 126 10 1;
	
begintalknode;
	state = 62;
	nextstate = 63;
	condition = gf(126,10) <= 1;
	question = "_Well, if I see them, I might be able to kill them for you._";
	text1 = "_That would be greatly appreciated. My home is in the southwest corner of Shayder. Don't expect the guards to help you, though. The guards there only help the Anama. Outsiders shouldn't expect help._";
	action = SET_SDF 126 10 1;
	code =	
		toggle_quest(36,1);
	break;

begintalknode;
	state = 63;
	nextstate = -1;
	question = "_Will I be able to get into your home?_";
	text1 = "_I ... That's a fair question. I sealed the entrance with brick before I left. The only easy way in is through the back entrance. Through the sewer._";
	
begintalknode;
	state = 58;
	nextstate = 59;
	question = "_What is a scribe?_";
	text1 = "_I write books. One of mine is on that pedestal over there._ She points to the southwest corner of the room. _This here is a little treatise I threw together._ She indicates a scroll on the table in front of her.";
	text2 = "_Now, to make money, I can also create magical scrolls. Interested in a purchase?_";

begintalknode;
	state = 59;
	nextstate = 58;
	question = "_What scrolls do you have for sale?_";
	text1 = "You conclude your business.";
	code =
		begin_shop_mode("Nell's Scrolls","Writing magical scrolls is a rare and difficult craft, but Nell seems to have mastered it.",45,4,3);
	break;


begintalknode;
	state = 57;
	nextstate = -1;
	question = "_Avernite? Me? Why ... uhhh ... I have to get going._";
	text1 = "_Fair enough. Safe travels. But rest assured that your secret, if it was a secret, would be safe with me._";
	action = END_TALK;


begintalknode;
	state = 57;
	nextstate = -1;
	condition = gf(126,10) == 1 && gf(4,11) >= 1;
	question = "_I visited your house and cleared out the cockroaches inside._";
	code =
		run_hardcode(16);
	break;

// Vok

begintalknode;
	tag = 100;
	state = -1;
	nextstate = 85;
	question = "Vok";
	text1 = "A large, smelly man stands near the docks. He holds several rolls of grimy tickets in his hands. _My name's Vok. I sell boat tickets._";
	text5 = "Vok lurks near the docks. He waves his tickets around and says, _No wasting my time with small talk. Buy or go._";
	action = INTRO;

begintalknode;
	state = 85;
	nextstate = 86;
	question = "_What are the tickets for?_";
	text1 = "_I got tickets for Port Townsend and Sharimik. Boat ride. Ten coins per group. Ask if you want to purchase one. And don't bug me otherwise. I ain't got time for small talk._";

begintalknode;
	state = 86;
	nextstate = -1;
	question = "_I'll take some tickets._";
	text1 = "_Which one, Sparky? Port Townsend or Sharimik?_";

begintalknode;
	state = 85;
	nextstate = 87;
	question = "_How come you won't make small talk?_";
	text1 = "He spits. _I sell the tickets. I hangs out with my own kind. You ain't it._";

begintalknode;
	state = 86;
	nextstate = -1;
	condition = coins_amount() >= 10;
	question = "_Ticket to Port Townsend please._ Pay 10 coins.";
	text1 = "You give him money, and he tears off some tickets. _Go to the end of the dock on the left and get on the boat._";
	text5 = "You have already bought this.";
	code =
		cs();
		if (gf(126,8) > 0)
			as(5);
			else {
				change_coins(-10);
				as(1);
				}
		sf(126,8,1);
	break;

begintalknode;
	state = 86;
	nextstate = -1;
	condition = coins_amount() >= 10 && gf(8,13) == 0;
	question = "_Ticket to Sharimik please._ Pay 10 coins.";
	text1 = "_Oh. Sorry. I shouldn't have offered to take you to Sharimik. The gates there are sealed. Some war going on up there. Troglodytes, I heard, whatever those are. You can only enter the city from land._";

begintalknode;
	state = 86;
	nextstate = -1;
	condition = coins_amount() >= 10 && gf(8,13) > 0;
	question = "_Ticket to Sharimik please._ Pay 10 coins.";
	text1 = "You give him your money and he tears off some tickets. _Go to the end of the dock on the right and get on the boat._";
	text5 = "You have already bought this.";
	code =
		cs();
		if (gf(126,9) > 0)
			as(5);
			else {
				as(1);
				change_coins(-10);
				}
		sf(126,9,1);
	break;

begintalknode;
	state = 86;
	nextstate = -1;
	question = "_I don't want any tickets._";
	text1 = "_Then we got nothin' to say to each other. Move along._";
	action = END_TALK;

begintalknode;
	state = 87;
	nextstate = -1;
	question = "_What is your kind?_";
	text1 = "_Sailors. Shipwrights. People who work for a livin'. And not stinking nephilim, that's for sure._";
	text3 = "_Sailors. Shipwrights. People who work for a livin'._";
	code =
		if (species_in_party(2))
			remove_string(3);
			else remove_string(1);
	break;

